#include "skill.h"
#include "campaign.h"
#include "dtwenty_defines.h"


#include <QDebug>
#include <QMetaEnum>
#include <QStringList>


namespace
{
static const int ATTR_ENUM = 0;
}


Skill::Skill(DataSuite *parent) :
    DataContainer(parent),
    d(new Data())
{
}

Skill::Skill(const Skill &other) :
    DataContainer(other),
    d(other.d)
{
}

Campaign::Attribute Skill::attribute() const
{
    return qvariant_cast<Campaign::Attribute>(d->attribute);
}

void Skill::setAttribute(Campaign::Attribute attribute)
{
    d->attribute = attribute;
}

int Skill::fieldCount() const
{
    int ret = DataContainer::fieldCount();
//    qDebug() << Q_FUNC_INFO << ret;
    return ret;
}

QVariant Skill::value(int field, int role) const
{
    if (field <= 0)
    {
        return DataContainer::value(field, role);
    }

    if (role == Qt::DisplayRole || role == Qt::EditRole)
    {
        return qvariant_cast<QString>(attribute());



//        QMetaEnum en = root()->metaObject()->enumerator(Campaign::Attributes);
//        return en.valueToKey(attribute());
    }

//    if (role == Qt::EditRole)
//    {
//        QVariantMap vm;

//    }

    return QVariant();
}

bool Skill::setValue(int field, const QVariant &value, int role)
{
    return DataContainer::setValue(field, value, role);
}

int Skill::internalFieldCount() const
{
    int ret = DataContainer::internalFieldCount();
//    qDebug() << Q_FUNC_INFO << ret;
    return ret;
}


